#ifndef TRAVELLING_H
#define TRAVELLING_H

#include "travelling_struct_csv.hpp"
#include "file_list.hpp"

#include "boost/date_time/posix_time/posix_time.hpp"
#include <iostream>
#include <fstream>

using namespace boost::posix_time;
using namespace boost::gregorian;



class travelling
{
  public:
	inline travelling() { }

	inline virtual ~travelling() {};

	// kilometers in the period
	//static float total_km(int _plate_id, date _first_date, date _last_date, bool _include_last_date = true);

	// estimated fuel consumption, in liters, for the specified period
	//virtual float estimated_fuel_consumption_liters(int _plate_id, date _first_date, date _last_date, bool _include_last_date =true) =0;

	// estimated fuel cost, in euro, for the specified period
	//virtual float estimated_fuel_consumption_cost(int _plate_id, date _first_date, date _last_date, bool _include_last_date =true) =0;

	// fuel refund for travelling in the period
	//static float fuel_refund(int _plate_id, date _first_date, date _last_date, bool _include_last_date =true);

  private:
};



// implementation for csv files

class travelling_csv: public travelling
{
  public:

	inline travelling_csv(char* filename): file(filename) { }
	inline travelling_csv() : file(file_list::travelling_filename()) { }

	~travelling_csv();

	static float total_km(int _plate_id, date _first_date, date _last_date, bool _include_last_date = true);
	static float fuel_refund(int _plate_id, date _first_date, date _last_date, bool _include_last_date =true);

	static float estimated_fuel_consumption_physical(int _plate_id, date _first_date, date _last_date, bool _include_last_date = true);
	static float estimated_fuel_consumption_financial(int _plate_id, date _first_date, date _last_date, bool _include_last_date = true);

	static float kilometer_report(int _plate_id, date _first_date, date _last_date, bool _include_last_date = true, std::ofstream* _fp=NULL);

  protected:
	static bool check_parm(travelling_struct_csv& row,
		int _plate_id, date _first_date, date _last_date, bool _include_last_date = true);


  private:
	std::string file;
};
#endif
